public class Text_Lambda {
    public static void main(String[] args) {


/*        Animal cat = new Animal(){
            @Override
            public void fun() {
                System.out.println("是只猫");
            }
        };*/
        //下面用Lambda表达式简化的代码跟上面的代码式等效的
        Animal cat = () -> {
                System.out.println("是只猫");
            };


/*        Animal dog = new Animal() {
            @Override
            public void fun() {
                System.out.println("是只狗");
            }
        };*/
        //下面用Lambda表达式简化的代码跟上面的代码式等效的
        Animal dog = () -> {
                System.out.println("是只狗");
            };

        cat.fun();
        dog.fun();

    }
}
interface Animal{
    public void fun();
}
